

#include "motorControl.h"


void initMc(void){

    // Enable Motor-PWM
    P1TCON = 0;
    P1TCONbits.PTEN = 1;

    // Time-Base-Settings
    P1TMR = 0;
    P1TPER = 1000;

    // Pin Settings
    PWM1CON1bits.PMOD1 = 0;
    PWM1CON1bits.PMOD2 = 0;
    PWM1CON1bits.PMOD2 = 0;
    PWM1CON1bits.PEN1H = 1;
    PWM1CON1bits.PEN1L = 1;
    PWM1CON1bits.PEN2H = 1;
    PWM1CON1bits.PEN2L = 1;
    PWM1CON1bits.PEN3H = 1;
    PWM1CON1bits.PEN3L = 1;

    PWM1CON2 = 0;

    // alle weiteren Register 0 setzen
    //P1DTCON1 = 0;
    P1DTCON1bits.DTBPS = 0b11;
    P1DTCON1bits.DTB = 64;
    P1DTCON2 = 0x002A;
    P1FLTACON = 0;
    P1OVDCON = 0;

    // PWM Duty Dycles (50%)
    P1DC1 = P1DC2 = P1DC3 = 500;


}



